package com.dy.controller;

import com.dy.service.SuagrService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @projectName: day0610_2
 * @package: com.dy.controller
 * @className: SugarController
 * @author: DuanYu
 * @description: TODO
 * @date: 2024/6/10 19:04
 * @version: 1.0
 */
@RestController
public class SugarController {
    @Autowired
    SuagrService service;
    @RequestMapping("/listTwo")
    public Map showTwo(){
        return SugarUtil.getPieData(service.showTwo());
    }
    @RequestMapping("/listPp")
    public Map showPp(){
        return SugarUtil.getBarData(service.showTwo());
    }
    @RequestMapping("/listNum")
    public Map showNum(){
        Double aDouble = service.showNum();
        Map map = new HashMap<>();
        map.put("status",0);
        map.put("data",aDouble);
        return map;
    }
    @RequestMapping("/listSpu")
    public String showSpu(){
      List list =   new ArrayList<>();
      list.add("名称");
      list.add("交易金额");
        return SugarUtil.getTablePlayData(list,service.showSpu());
    }
}
